/***************************************************************************
 *   Copyright (C) 2006 by Sergey Melderis   *
 *   sergey.melderis@gmail.com   *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   This program is distributed in the hope that it will be useful,       *
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
#ifndef WORDQUIZFILECHOOSER_H
#define WORDQUIZFILECHOOSER_H

#include <kdialogbase.h>
#include <qmap.h>
#include <qpair.h>
class QListBox;
class QPushButton;
class QStringList;
class QLineEdit;
class KURLRequester;
/**
	@author Sergey Melderis <sergey.melderis@gmail.com>
*/
class WordQuizFileChooser : public KDialogBase
{
Q_OBJECT
public:
    WordQuizFileChooser(QWidget *parent, const char *name = 0);

    ~WordQuizFileChooser();

signals:
    void selectionChanged(bool);
    
protected slots:
    void add();
    void edit();
    void remove();
   // void up();
    //void down();
    void selectionChanged(int);

private:
    QListBox *m_filesListBox;
    QPushButton *m_addButton;
    QPushButton *m_removeButton;
    QPushButton *m_editButton;
    QPushButton *m_upButton;
    QPushButton *m_downButton;

    bool m_changed;
  
};
typedef QPair<QString, QString> KeyFileName;


class KeyUrlDialog : public KDialogBase
{
Q_OBJECT
public:
    KeyUrlDialog(const QString &url, const QString &urlName,
             QWidget *parent = 0, const char *name = 0);
    ~KeyUrlDialog();

    static KeyFileName getKeyUrlPair(const QString &url = QString::null,
                                               const QString &urlName = QString::null,
                                               QWidget *parent = 0);
    QString selectedUrl() const;
    QString key() const;

private slots:
    void clear();
    void slotTextChanged(const QString &);
private:
    QLineEdit *m_keyLineEdit;
    KURLRequester *m_urlRequester;
    void initDialog(const QString &url, const QString &urlName);

    QPushButton *m_okButton;
    QPushButton *m_cancelButton;
};

#endif
